<?php
session_start();//开启会话
if ( isset($_POST['sub']) ) {
 	if ( $_POST['sub'] == $_SESSION['scode'] ) {
		echo  "<script>alert('验证成功')</script>";
	}else{
		echo  "<script>alert('验证失败')</script>";
	}
}
?>

<form action="form.php" method="post">
<div>
	<label for="sub">输入图片中数字的和</label>
	<img src="gd_sub_num.php" onclick="this.src='gd_sub_num.php?time='+new Date().getTime()" style="cursor:hand;">
	<input type="text" name="sub" id="sub" size="10" maxlength="10"><br>
	<input type="submit" value="提交">
	<input type="reset" value="重置">	
</div>
</form>	

